<template>
  <div class="wrap" v-ripple="{ color: 'rgb(143, 143, 143)' }">
    <div class="img-wrap">
      <ScaleImage :imgUrl="boxItem.imageUrl" heightScale="80.3%" />
      <ScaleImage
        class="inner-img"
        heightScale="75.12%"
        imgUrl="https://img.ezgskin.com/upload/2021/05/13/e9f09c3213f13bd4dfc8406f777d64f9.png"
      />
    </div>
    <div class="title">{{ boxItem.name }}</div>
    <div class="operation">
      <i class="icon iconfont icon-meiyuan"></i>
      <span class="text">{{ boxItem.price }}</span>
      <div class="circle">打开</div>
    </div>
  </div>
</template>

<script>
import ScaleImage from 'common/scale-image/scale-image.vue'
export default {
  props: {
    boxItem: {
      type: Object,
      default: () => { }
    },
  },
  components: {
    ScaleImage
  }
}
</script>

<style lang="less" scope>
.wrap {
  position: relative;
  background: none;
  color: rgb(143, 143, 143);
  &:hover {
    .img-wrap {
      .inner-img {
        animation: animate 1.7s ease-in-out infinite;
      }
    }
    .operation .circle {
      display: flex;
    }
  }

  .img-wrap {
    position: relative;
    font-size: 0;

    .inner-img {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate3d(-50%, -50%, 0);
      width: 70%;
    }
  }
  .title {
    margin-bottom: 12px;
    display: block;
    text-align: center;
    font-size: 16px;
    height: 28px;
    line-height: 28px;
    color: #c3c3e2;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .operation {
    margin: auto;
    width: min-content;
    display: flex;
    align-items: center;
    padding: 0;
    overflow: hidden;
    position: relative;
    border: 1px solid #e9b10e;
    border-radius: 50px;
    height: 34px;

    .icon {
      padding-left: 10px;
      display: block;
      height: 14px;
      line-height: 14px;
      font-size: 0;
      // width: 14px;
      color: #e9b10e;

      &::before {
        font-size: 14px;

        display: inline-block;
        width: 14px;
        height: 14px;
      }
    }

    .text {
      padding-right: 10px;
      display: inline-block;
      width: min-content;
      padding-left: 9px;
      height: 14px;
      line-height: 14px;
      font-size: 14px;
      color: rgb(233, 177, 14);
    }

    .circle {
      white-space: nowrap;
      width: min-content;
      padding: 0 16px;
      height: auto;
      align-self: stretch;
      // display: flex;
      display: none;
      justify-content: center;
      align-items: center;
      border-radius: 32px;
      font-size: 14px;
      color: black;
      background-color: #e9b10e;
    }
  }
}

@keyframes animate {
  0% {
    transform: translate3d(-50%, calc(-50%), 0);
  }
  50% {
    transform: translate3d(-50%, calc(-50% - 25px), 0);
  }
  100% {
    transform: translate3d(-50%, calc(-50%), 0);
  }
}
</style>